24. Exercise: Finding Views Efficiently
L1 56 Finding Views Efficiently SC
Here is additional information on the topic of late initialization if you are curious: late-initialized-properties-and-variables.
Now it’s your turn to complete this exercise yourself.
1. Use lateinit to extract the image view variable:
lateinit var diceImage: ImageView
2. Initialize the image view variable:
diceImage = findViewById(R.id.dice_image)
If you want to start at this step, you can download this exercise code here: Step.05-Exercise-Finding-Views-Efficiently.
You will find plenty of //TODO comments to help you complete this exercise, and if you get stuck, go back and watch the video again.
Once you’re done, you can check your solution against the solution we’ve provided here Step.05-Solution-Finding-Views-Efficiently or using this git diff.
Task Description:
Check the steps below as you implement them to complete this exercise.
Task Feedback:
That’s all there is to it!
Solution: Step.05-Solution-Finding-Views-Efficiently or using this git diff.